Conversation
|
@anthonykim1 Gonna add the ioctl's for TIOCGWINSZ/TIOCSWINSZ to the node-termios package, then you don't have to shim it with your own C helper. |
|
@jerch we don't use that atm though and want to avoid including dev dependencies in general? |
|
@Tyriar No need to include into the automated CI testing. It is more helpful for exploring local tests as @anthonykim1 did above and would spare the need to go into C yourself (so it would help any JS/TS dev without any C experience). |
|
@anthonykim1 The new package is online now: https://www.npmjs.com/package/node-termios/v/0.2.0 With it you can create a console app in nodejs tracking the TTY size like this: const { native: { tcgetwinsize } } = require('node-termios');
// file descriptor of STDIN
const STDIN_FD = 0;
// needed to keep the process running
// (not needed if you keep the event loop running by other means)
process.stdin.resume();
// register a signal handler for SIGWINCH
process.on('SIGWINCH', () => {
console.log('TTY size:', tcgetwinsize(STDIN_FD));
});and then resizing the terminal window. This works only under macos/linux though (prolly also under FreeBSD, Solaris is untested). |



From: xtermjs/xterm.js#5619 (comment)